package edu.sctu.practice.class01.zhoumengxue.assign.assign05.assign05_04;

/**
 * Created by ASUS on 2015/12/10.
 */
public class Sub_sort_Demo extends Sort_Demo{
    void sort(int t1, int t2[]) {            //子类中的方法实现降序
        //用选择法实现降序排列
        for (int i = 0; i < t1 - 1; i++) {
            int k = i;
            for (int j = i + 1; j < t1; j++)
                if (t2[j] > t2[k]) k = j;
            if (k != i) {
                int swap = t2[i];
                t2[i] = t2[k];
                t2[k] = swap;
            }
        }
    }

}
